package com.atguigu.vod.controller;

import com.atguigu.commonutils.R;
import com.atguigu.vod.empty.VideoOss;
import com.atguigu.vod.service.VodService;
import com.atguigu.vod.utils.ConstantPropertiesUtil;
import com.atguigu.vod.utils.Signature;
import com.atguigu.servicebase.exceptionhandler.GuliException;
import com.mysql.jdbc.log.Log;
import com.tencentcloudapi.vod.v20180717.VodClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;
import java.util.Map;
import java.util.Random;

/**
 * @author shkstart
 * @create 2022-09-28 16:48
 */
//腾讯云点播
@RestController
@RequestMapping("/eduvod/video")
public class VodController {

    @Autowired
    private VodService vodService;

    //上传视频
    @PostMapping("uploadVideo")
    public R upload(@RequestParam("file") MultipartFile uploadFile) {
        VideoOss videoOss = vodService.uploadVideo(uploadFile);
        return R.ok().data("videoOss", videoOss);
    }

    //删除腾讯云视频
    @DeleteMapping("removeVideo/{videoId}")
    public R remove(@PathVariable String videoId) {
        vodService.removeVideo(videoId);
        return R.ok();
    }

    //删除多个腾讯云视频的方法
    @DeleteMapping("delete-batch")
    public R deleteBatch(@RequestParam("videoList") List<String> videoList) {
        vodService.removeMoreVideo(videoList);
        return R.ok();
    }

}

